package com.atguigu.day05.HomeWork;

import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/4 18:25
 * @注释 输入月份,打印月份对应的英文单词
 */
public class HomeWork1 {
    public static void main(String[] args) {
        String[] month = {"January","February","March","April","May","June","July","August","September","October","November","December"};
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入月份:");
        int monthNum = sc.nextInt();
        if(monthNum < 1 || monthNum > 12){
            System.out.println("月份输入错误");
        }else{
            System.out.println(monthNum + "月的英文单词是:" + month[monthNum-1]);
        }
        /*for (int i = 0, index = 0; i < month.length; i++, index++) {
            if(monthNum == index+1){
                System.out.println(monthNum + "月的英文单词是:" + month[i]);
            }
        }*/
    }
}
